import request from '@/utils/request'

/** *
 * 获取角色列表
 * **/
export const getRoleListApi = (params) => request({ url: '/sys/role', params })

/** **
 * 新增角色
 * ***/

export const addRoleApi = (data) => request({ url: '/sys/role', method: 'post', data })

/** *
 * 删除角色
 * **/

export const delRoleApi = (id) => request({ url: `/sys/role/${id}`, method: 'delete' })

/**
 * 更新角色
 * ***/

export const updateRoleApi = (data) => request({ url: `/sys/role/${data.id}`, method: 'put', data })

/**
 * 获取可用的角色
 * **/

export const getEnableRoleListApi = () => request({ url: '/sys/role/list/enabled' })

/**
 * 分配员工角色
 * ***/

export const assignRoleApi = (data) => request({ url: '/sys/user/assignRoles', method: 'put', data })

/**
 * 获取角色详情
 * **/

export const getRoleDetailApi = (id) => request({ url: `/sys/role/${id}` })

/**
 * 给角色分配权限
 *
 * ***/

export const assignPermApi = (data) => request({ url: '/sys/role/assignPrem', method: 'put', data })

